package com.construction.engineering.accounting.task;

import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@EnableScheduling
public class ScheduledSyncRefundTasks {

    // 使用cron表达式（每分钟的第30秒执行） @Scheduled默认单机串行，同一类中只允许这一个服务
    @Scheduled(cron = "30 * * * * ?")
    public void taskWithCronExpression() throws InterruptedException {
        System.out.println("Cron Expression Task :: Execution Time - " + System.currentTimeMillis());
        Thread.sleep(1000000); // 模拟耗时10秒
        System.out.println("Cron Expression Task :: Execution Time - " + System.currentTimeMillis());
    }

}
